package com.example.mimile_home;
import com.mysql.cj.jdbc.Driver;
import com.example.mimile_home.Users;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;


import java.io.IOException;
import java.io.InputStream;
import java.util.List;

public class TestSQL {
    @Test
    public void test1() throws IOException {
        String resource = "config.xml";
        InputStream is = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(is);
        SqlSession session= sqlSessionFactory.openSession();
        List<Users> list = session.selectList("usersList",1);
        for (Users user:list){
            System.out.println(user);
        }
        session.close();
    }
}